package jue;

public class MyThread extends Thread{
    private int bh;

    public MyThread(String name,int bh){
        super(name);
        this.bh=bh;
    }


    public void run() {
        synchronized (MyThread.class){
            A.bh=bh;
            try {Thread.sleep(20);} catch (InterruptedException e) {}
            String sql="select * from where bh="+A.bh;
            System.out.println(this+"-->"+sql);
        }

    }

    public String toString(){
        return "线程[name:"+this.getName()+",bh:"+bh+"]";
    }

    public static void main(String[] args) {
        new MyThread("线程1",5).start();
        new MyThread("线程2",8).start();
        new MyThread("线程2",10).start();
    }
}
